﻿using Abp.AutoMapper;
using AutoMapper;
using NetCore.Entities.Projects;
using NetCore.Projects.Dtos;
using NetCore.Users.Dto;

namespace NetCore.Projects
{
    public class ProjectDtoMapper : Profile
    {
        public ProjectDtoMapper()
        {
            CreateMap<Project, ProjectDto>()
                .ForMember(m => m.OrganizationName, opt => opt.MapFrom(n => n.Organization.Name));//不使用三目运算符也不会报错
            CreateMap<ProjectUser, ProjectUserDto>()
                .ForMember(m => m.User, opt => opt.MapFrom(n => n.User.MapTo<UserDto>()));
            CreateMap<ProjectAttachment, ProjectAttachmentDto>();
        }
    }
}
